<template>
	<view class="index p10">
		<view class="p10 dfbc bs6 bf mb10">
			<u-radio-group v-model="selectType" placement='column' iconPlacement='right' iconColor="#000" @change="changePay">
				<u-radio :activeColor="subColor"  name="用户信息错误" :labelSize="14" :iconSize="14"
					:customStyle="{marginBottom: '50rpx'}" label="用户信息错误"></u-radio>
				<u-radio :activeColor="subColor" name="商品已经售完" :labelSize="14" :iconSize="14"
					:customStyle="{marginBottom: '50rpx'}" label="商品已经售完">
				</u-radio>
				<u-radio :activeColor="subColor" name="门店已经打烊" :labelSize="14" :iconSize="14"
					:customStyle="{marginBottom: '50rpx'}" label="门店已经打烊"></u-radio>
				<u-radio :activeColor="subColor" name="门店现在太忙" :labelSize="14" :iconSize="14"
					:customStyle="{marginBottom: '50rpx'}" label="门店现在太忙"></u-radio>
				<u-radio :activeColor="subColor" name="商品单点不送" :labelSize="14" :iconSize="14"
					:customStyle="{marginBottom: '50rpx'}" label="商品单点不送"></u-radio>
				<block v-if="scene==1">
					<u-radio :activeColor="subColor" name="配送出现问题" :labelSize="14" :iconSize="14"
						:customStyle="{marginBottom: '50rpx'}" label="配送出现问题"></u-radio>
					<u-radio :activeColor="subColor" name="超出配送范围" :labelSize="14" :iconSize="14"
						:customStyle="{marginBottom: '50rpx'}" label="超出配送范围"></u-radio>
					<u-radio :activeColor="subColor" name="骑手无人接单" :labelSize="14" :iconSize="14"
						:customStyle="{marginBottom: '50rpx'}" label="暂无骑手接单"></u-radio>
				</block>
				<u-radio :activeColor="subColor" name="9" :labelSize="14" :iconSize="14"
					:customStyle="{marginBottom: '50rpx'}" label="其他原因"></u-radio>
			</u-radio-group>
		</view>
		<view class="p10 bs6 bf mb10" v-if="selectType=='9'">
			<view class="mb10 c0">其他原因</view>
			<u--textarea v-model="reason" placeholder="选填"></u--textarea>
		</view>
		<view class="but p10">
			<u-button text="确认拒单" :color="subColor" shape="circle" size="large" @click="save">
			</u-button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				subColor: uni.getStorageSync('subject_color'),
				check: [0],
				reason: '',
				id: '',
				scene: '',
				storeId: '',
				type: '',
				selectType: '',
			}
		},
		onLoad(options) {
			if (options && options.id) {
				this.id = options.id
				this.scene = options.scene
				this.storeId = options.storeId
				this.type = options.type
			}
		},
		methods: {
			changePay(e) {
				this.selectType = e
				if (e == '9') {
					this.reason = ''
				} else {
					this.reason = e
				}
			},
			async save() {
				if (!this.reason) {
					return uni.$u.toast('请输入原因')
				}
				let {
					msg
				} = await this.beg.request({
					url: `${this.api.refund}/${this.id}`,
					method: "POST",
					data: {
						storeId: this.storeId,
						refundCause: this.reason,
					},
				})
				uni.$u.toast(msg)
				setTimeout(() => {
					uni.navigateBack({
						delta: 1
					})
				}, 500)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.but {
		width: 100%;
		position: fixed;
		left: 0;
		bottom: 100rpx;

		/deep/.u-button__text {
			font-size: 33rpx !important;
		}
	}
</style>